<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="ext.acae2.dms.web.input.SubmitProcessor" %>
<%@ page import="ext.acae2.dms.resource.DataExchangeResource" %>
<%@ page import="wt.util.WTMessage" %>

<%
String result = new SubmitProcessor().process(request);

String RESOURCE = DataExchangeResource.class.getName();

String success_msg = WTMessage.getLocalizedMessage(RESOURCE, DataExchangeResource.DATA_PACK_SUBMIT_SUCCESS);
String number_msg = WTMessage.getLocalizedMessage(RESOURCE, DataExchangeResource.DATA_PACK_NUMBER);
String path_msg = WTMessage.getLocalizedMessage(RESOURCE, DataExchangeResource.DATA_PACK_PATH);
String failure_msg = WTMessage.getLocalizedMessage(RESOURCE, DataExchangeResource.DATA_PACK_SUBMIT_FAILURE);

StringBuffer msg = new StringBuffer();

if (result.equalsIgnoreCase("error")) {
    out.println("<script>parent.callback('" + failure_msg + "')</script>");
}
else {
    String number = result.split(",")[0];
    String path = result.split(",")[1];
    msg.append(success_msg);
    msg.append("\\n");
    msg.append(number_msg);
    msg.append(number);
    msg.append("\\n");
    msg.append(path_msg);
    msg.append(path);
    out.println("<script>parent.callback('" + msg.toString() + "')</script>");            
}
%>